from flask import Flask,render_template
import sqlite3
app = Flask(__name__)
@app.route('/')
def index():
    return render_template("index.html")

@app.route('/index')
def home():
    return render_template("index.html")

@app.route('/movie')
def movie():
    datalist = []
    connect = sqlite3.connect("movie.db")
    cur = connect.cursor()
    sql = "SELECT * FROM  movie250"
    data = cur.execute(sql)
    for item in data:
        datalist.append(item)
    cur.close()
    connect.close()
    return render_template("movie.html",movies=datalist)

@app.route('/score')
def score():
    score = []
    num = []
    connect = sqlite3.connect("movie.db")
    cur = connect.cursor()
    sql = "SELECT score, count(score) FROM  movie250 group by score"
    data = cur.execute(sql)
    for item in data:
        score.append(str(item[0]))
        num.append(item[1])
    cur.close()
    connect.close()
    return render_template("score.html",score=score,num=num)

@app.route('/team')
def team():
    return render_template("team.html")

@app.route('/word')
def word():
    return render_template("word.html")

@app.route('/test')
def test():
    return render_template("test.html")






if __name__ == '__main__':
    app.debug = True # 设置调试模式，生产模式的时候要关掉debug
    app.run()